package com.ctgu.com;

import java.util.Arrays;

public class Commission {
	
	
	public static String classify(int locks, int stocks, int  barrels){
		
		double lockprice = 45;
		double stockprice = 30;
		double barrelprice = 25;
		double totallocks = 0;
		double totalstocks = 0;
		double totalbarrels = 0 ;
		double commission =0;
		
		
		if(locks == -1)
			return "当月销售活动已结束！";
		else if(locks!=-1 )
		{
			if(1>locks|| locks>70){
				return "对不起，枪机数不能为负数且厂商限制一个月只能卖出少于70个！";
				}
			if(1>=stocks || stocks >=80){
				return "对不起，枪托数不能为负数且厂商限制一个月只能卖出少于80个！";
			}
			if(1>=barrels || barrels >= 90){
				return  "对不起，枪管数不能为负数且厂商限制一个月只能卖出少于90个！";
			}
			
				totallocks = totallocks +locks;
				totalstocks = totalstocks +stocks;
				totalbarrels = totalbarrels + barrels;
				
				double locksales = lockprice*totallocks;
				double stocksales = stockprice*totalstocks;
				double barrelsales = barrelprice*totalbarrels;
				
				double sales = locksales + stocksales + barrelsales;
				
				if(sales>1800){
					commission = 0.10*1000;
					commission = commission + 0.15*800;
					commission = commission + 0.20*(sales-1800);
				}
				else if(sales>1000){
					commission = 0.10*1000;
					commission = commission+0.15*(sales-1000);
				}
				else
					commission=0.10*sales;
				
		}
				String yongjing = Double.toString(commission);
				return "佣金是："+yongjing;
				

		}
				
}
